package io.awen.modules.sign.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.awen.modules.sign.entity.SignCarTaskLonLatEntity;
import io.awen.modules.sign.service.SignCarTaskLonLatService;
import io.awen.common.utils.PageUtils;
import io.awen.common.utils.R;



/**
 * 收运单位车辆收运途中经纬度临时记录表
 *
 * @author liu.wen
 * @email liu.wen@qq.com
 * @date 2022-08-16 23:39:34
 */
@RestController
@RequestMapping("sign/signcartasklonlat")
public class SignCarTaskLonLatController {
    @Autowired
    private SignCarTaskLonLatService signCarTaskLonLatService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sign:signcartasklonlat:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = signCarTaskLonLatService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sign:signcartasklonlat:info")
    public R info(@PathVariable("id") Long id){
		SignCarTaskLonLatEntity signCarTaskLonLat = signCarTaskLonLatService.getById(id);

        return R.ok().put("signCarTaskLonLat", signCarTaskLonLat);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sign:signcartasklonlat:save")
    public R save(@RequestBody SignCarTaskLonLatEntity signCarTaskLonLat){
		signCarTaskLonLatService.save(signCarTaskLonLat);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sign:signcartasklonlat:update")
    public R update(@RequestBody SignCarTaskLonLatEntity signCarTaskLonLat){
		signCarTaskLonLatService.updateById(signCarTaskLonLat);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sign:signcartasklonlat:delete")
    public R delete(@RequestBody Long[] ids){
		signCarTaskLonLatService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
